package com.server.server_a10.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.server.server_a10.entity.lightingSystem.Light;
import lombok.Data;
import lombok.Value;

import java.util.List;

/**
 * 用户类，用来登录验证，不知道有啥用
 * Param:
 * id 用户唯一识别码
 * name 姓名
 * passwd 现在用明码
 * isAdmin 默认为false，管理员识别码
 */

@Data
@TableName(value = "user")
public class User{
    @TableId(value = "id", type = IdType.AUTO)
    private long id;
    @TableField(value = "name")
    private String name;

    @TableField(value="sex")
    private String sex;
    @TableField(value = "address")
    private String address;

    @TableField(value = "phone")
    private String phone;

    @TableField(value = "email")
    private String email;

    @TableField(value = "passwd")
    private String passwd;
    @TableField(value = "isAdmin")
    private boolean isAdmin;
    @TableField(exist = false)
    private List<Home> homes;
    public boolean getIsAdmin(){
        return this.isAdmin;
    }

    public User() {
    }
    public User(long id){
        this.id=id;
    }

    public User(long id, String name) {
        this.id = id;
        this.name = name;
    }
}
